﻿using Hsp.Auto.Model.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Data;
using System.Text;

namespace Hsp.Auto.Model.Dtos
{
    public class ColumnDto: Columns
    {
        /// <summary>
        /// 近似类型
        /// </summary>
        [Display(Name = "近似类型")]
        public LikeType LikeType
        {
            get
            {
                if (this.DbType == DbType.Decimal || this.DbType == DbType.Double
                    || this.DbType == DbType.Int16
                    || this.DbType == DbType.Int32
                     || this.DbType == DbType.Int64
                    )
                {
                    return LikeType.Number;
                }
                else if (this.DbType == DbType.Date || this.DbType == DbType.DateTime
                    || this.DbType == DbType.DateTime2 || this.DbType == DbType.DateTimeOffset)
                {
                    return LikeType.DateTime;
                }
                else
                {
                    return LikeType.String;
                }
            }
        }

        /// <summary>
        /// DbType类型
        /// </summary>
        [Display(Name = "DbType类型")]
        public DbType DbType { get; set; }
    }
}
